class AuthController < ApplicationController
    	before_filter :auth , :except => "login"
        layout "common_layout"
	def index
		redirect_to :action => "login"
	end

	def login
		if request.post?
			@user = User.auth params[:login_id],params[:password]
			if @user 
				session[:user_id] = @user.id
                                session[:user_login_id] = @user.login_id
                                session[:user_name] = @user.name
				redirect_to :controller=>'boards' , :action=>'list' 
			else
				flash[:notice] = "아이디랑 패스워드가 틀립니다."
			end
		end
	end

	def logout
		session[:user_id] = nil
		@user = nil
	end
end
